/*
 * @Author       : 骇熊的锅
 * @Date         : 2024-08-03 22:16:30
 * @LastEditTime : 2024-08-03 22:20:04
 * @Description  : 
 */
/**
 * @description: 数据重构与映射
 * @param {type} initializeData
 */
function deconstruction(initializeData) {
    let containers = {}
    initializeData.forEach(obj => {
        containers[obj.name] =
        {
            name: obj.item2,
            id: obj.id,
            type: obj.type
        }
    })
    return containers
}
const initializeData = [
    { name: "container1", item2: "itemA", id: 1, type: "type1" },
    { name: "container2", item2: "itemB", id: 2, type: "type2" },
    { name: "container3", item2: "itemC", id: 3, type: "type3" }
];
const containers = deconstruction(initializeData);
console.log("🚀 ~ containers:", containers)
Object.keys(containers).forEach(key => {
    console.log(containers[key]);
});